//package com.mxsoft.takeaway.component;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import lombok.extern.slf4j.Slf4j;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @author zhangyingxuan
// */
//@Slf4j
////@Component
////@Aspect
//public class SysLogAspect {
//
//    @Around("execution(* com.mxsoft.takeaway.web.controller.*Controller.*(..))")
//    public Object logMethod(ProceedingJoinPoint joinPoint) throws Throwable {
//
//        Object retVal = joinPoint.proceed();
//
//            try {
//                StringBuilder logInfo = new StringBuilder();
//                logInfo.append(joinPoint.getTarget().getClass().getName());
//                logInfo.append(".");
//                logInfo.append(joinPoint.getSignature().getName());
//                logInfo.append("(");
//
//                Object[] args = joinPoint.getArgs();
//                for (int i = 0; i < args.length; i++) {
//                    if (args[i] instanceof HttpServletRequest || args[i] instanceof HttpServletResponse) {
//                        continue;
//                    }
//                    logInfo.append(new ObjectMapper().writeValueAsString(args[i])).append(",");
//                }
//                if (args.length > 0) {
//                    logInfo.deleteCharAt(logInfo.length() - 1);
//                }
//
//                logInfo.append(")");
//                logInfo.append(" retVal: ");
//                logInfo.append(new ObjectMapper().writeValueAsString(retVal));
//                log.info(logInfo.toString());
//            } catch (Exception e) {
//                log.warn("log error, Exception: ", e);
//            }
//        return retVal;
//    }
//}